wake_feature = load('scale_wake', '-ascii');
n1_feature = load('scale_n1', '-ascii');
n2_feature = load('scale_n2', '-ascii');
n3_n4_feature = load('scale_n3', '-ascii');
r_feature = load('scale_r', '-ascii');
train_wake_num = 200;
train_n1_num = 100;
train_n2_num = 200;
train_n3_n4_num = 200;
train_rem_num = 100;
test_wake_num = 50;
test_n1_num = 30;
test_n2_num = 150;
test_n3_n4_num = 100;
test_rem_num = 50;


x2= n1_feature(1:train_n1_num, :)'; x5 = r_feature(1:train_rem_num, :)';
x4 = n3_n4_feature(1:train_n1_num, :)'; x3 = n2_feature(1:train_n1_num, :)';
x1 = wake_feature(1:train_n1_num, :)';

X = [x1, x5];
opts = statset('Display','final');

[idx,ctrs] = kmeans(X,2,...
                    'Distance','city',...
                    'Replicates',5,...
                    'Options',opts);
imshow(x1)
figure
plot(x1,'r.','MarkerSize',12)
hold on
plot(x5,'b.','MarkerSize',12)
plot(ctrs(:,1),ctrs(:,2),'kx',...
     'MarkerSize',12,'LineWidth',2)
plot(ctrs(:,1),ctrs(:,2),'ko',...
     'MarkerSize',12,'LineWidth',2)
legend('Cluster 1','Cluster 2','Centroids',...
       'Location','NW')